home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / cmdity / yk212src.lha / Yak_2.12_Src / Include / Hotkey_types.h < prev    next >
C/C++ Source or Header  |  1995-12-31  |  6KB  |  249 lines

  1. /*
  2.  * Definitions for generic Yak hotkeys.
  3.  * mws, 27 April 1993
  4.  */
  5.  
  6. #ifndef HOTKEY_TYPES_H
  7. #define HOTKEY_TYPES_H
  8.  
  9. #ifndef EXEC_TYPES_H
  10. #include <exec/types.h>
  11. #endif /* EXEC_TYPES_H */
  12.  
  13. #ifndef EXEC_NODES_H
  14. #include <exec/nodes.h>
  15. #endif /* EXEC_NODES_H */
  16.  
  17. #ifndef EXEC_LISTS_H
  18. #include <exec/lists.h>
  19. #endif /* EXEC_LISTS_H */
  20.  
  21. #ifndef LIBRARIES_COMMODITIES_H
  22. #include <libraries/commodities.h>
  23. #endif /* LIBRARIES_COMMODITIES_H */
  24.  
  25.  
  26. /*
  27.  * YakOption structure definition
  28.  */
  29. typedef struct {
  30.     UWORD   Flags;
  31.     STRPTR *ArgStr;
  32.     LONG   *ArgNum;
  33. } YakOption;
  34.  
  35.  
  36. /*
  37.  * YakHotKey structure definition
  38.  */
  39. typedef struct {
  40.         struct Node      yhk_Node;      /* node for linked-list */
  41.         CxObj           *yhk_CxObj;     /* cx object list */
  42.         UWORD            yhk_Type;      /* hotkey type */
  43.         char            *yhk_KeyDef;    /* actual key definition */
  44.         UWORD            yhk_State;     /* hotkey state  */
  45.         char            *yhk_Name;      /* hotkey name */
  46.         YakOption       *yhk_Option;    /* hotkey options */
  47. } YakHotKey;
  48.  
  49.  
  50. #define EMPTY_MINLIST {NULL,NULL,NULL}
  51.  
  52. /*
  53.  * Types of hotkey currently supported
  54.  */
  55.  
  56. #define EXECUTE_COMMAND      0
  57. #define CLOSE_WINDOW         1
  58. #define ZIP_WINDOW           2
  59. #define SHRINK_WINDOW        3
  60. #define EXPAND_WINDOW        4
  61. #define MOVE_WINDOW          5
  62. #define CYCLE_WINDOWS        6
  63. #define OPEN_PALETTE         7
  64. #define SCREEN_TO_FRONT      8
  65. #define SCREEN_TO_BACK       9
  66. #define CENTRE_SCREEN        10
  67. #define ACTIVATE_WORKBENCH   11
  68. #define BLANK_DISPLAY        12
  69. #define INSERT_TEXT          13
  70. #define INSERT_DATE          14
  71. #define SHOW_INTERFACE       15
  72. #define SET_DEF_PUB_SCREEN   16
  73. #define MENU_SHORTCUT        17
  74. #define ICONIFY_WINDOW       18
  75. #define NUM_HOTKEY_TYPES     19
  76.  
  77.  
  78. /*
  79.  * YakHotKey states.
  80.  */
  81. #define YKHK_INACTIVE 0
  82. #define YKHK_ACTIVE   1
  83. #define NUM_STATES    2
  84.  
  85. /*
  86.  * YakHotKey click types.
  87.  */
  88. #define YKHK_SIMPLE   0
  89. #define YKHK_DOUBLE   1
  90. #define YKHK_TRIPLE   2
  91. #define NUM_CLICKS    3
  92.  
  93.  
  94. /*
  95.  * This structure describes an option of a hotkey
  96.  */
  97.  
  98. typedef struct {
  99.     UBYTE     Type;
  100.     UWORD     LocalID;
  101. #ifdef PREFS
  102.     APTR      LabelID;
  103.     UWORD     ExcludeIDs;
  104.     UWORD     ActivateIDs;
  105.     UWORD     DisplayID;
  106. #endif
  107. #if defined(PREFS) || defined(CONV)
  108.     UWORD     DefFlag;
  109.     STRPTR    DefArgStr;
  110.     LONG      DefArgNum;
  111. #endif
  112. } OptDescription;
  113.  
  114.  
  115. /* Types */
  116. #define NO_OPT      0
  117. #define TOGGLE_OPT  1
  118. #define STRING_OPT  2
  119. #define INTEGER_OPT 3
  120.  
  121.  
  122. typedef struct {
  123.     OptDescription *Desc;
  124. #ifdef PREFS
  125.     APTR            LabelID;
  126. #endif
  127. } OptsList;
  128.  
  129.  
  130. /*
  131.  * YakHotKeyType structure
  132.  */
  133. typedef struct {
  134.         struct MinList yhkt_list;                    /* list of keys */
  135. #if defined(PREFS) || defined(CONV)
  136.         APTR           yhkt_nameID;                  /* locale string identifier for name */
  137. #else
  138.         void         (*yhkt_Command)(YakHotKey *);   /* command to call */
  139. #endif 
  140. #ifdef PREFS
  141.         char          *yhkt_HelpNode;                /* online help */
  142. #endif
  143.         UWORD          yhkt_OptsNum;
  144.         OptsList      *yhkt_OptsList;
  145. } YakHotKeyType;
  146.  
  147.  
  148. /*
  149.  * Options
  150.  */
  151.  
  152. GLOBAL OptDescription ChangeScreenHKOption[];
  153.  
  154. /* Change Screen */
  155. #define HKO_NO_SCREEN_CHANGE         (1<<0)
  156. #define HKO_WORKBENCH_TO_FRONT       (1<<1)
  157. #define HKO_DEFAULT_PUBSCR_TO_FRONT  (1<<2)
  158.  
  159. /* Commands */
  160. #define HKO_CLI_COMMAND        (1<<0)
  161. #define HKO_AREXX_COMMAND      (1<<1)
  162. #define HKO_STACK_COMMAND      (1<<2)
  163. #define HKO_PRIORITY_COMMAND   (1<<3)
  164. #define HKO_COMMAND            (1<<4)
  165. #define HKO_AREXX_PORT         (1<<5)
  166.  
  167. /* Select Window & Screen */
  168. #define HKO_ACTIVE          (1<<0)
  169. #define HKO_UNDER_MOUSE     (1<<1)
  170. #define HKO_BY_TITLE        (1<<2)
  171. #define HKO_PATTERN         (1<<3)
  172. #define HKO_REARMOST        (1<<4)        /* Screen To Front */
  173. #define HKO_FRONTMOST       (1<<5)        /* Screen To Back */
  174.  
  175. /* Resize Window */
  176. #define HKO_RESIZE_HORIZONTAL  (1<<0)
  177. #define HKO_RESIZE_VERTICAL    (1<<1)
  178. #define HKO_RESIZE_VISIBLE_BAR (1<<2)
  179.  
  180. /* Move Window & Screen */
  181. #define HKO_NO_VERTICAL_MOVING     (1<<0)
  182. #define HKO_MOVE_TOP               (1<<1)
  183. #define HKO_MOVE_VERTICAL_CENTER   (1<<2)
  184. #define HKO_MOVE_BOTTOM            (1<<3)
  185. #define HKO_NO_HORIZONTAL_MOVING   (1<<4)
  186. #define HKO_MOVE_LEFT              (1<<5)
  187. #define HKO_MOVE_HORIZONTAL_CENTER (1<<6)
  188. #define HKO_MOVE_RIGHT             (1<<7)
  189. #define HKO_MOVE_VISIBLE_BAR       (1<<8)  /* Move Window */
  190. #define HKO_MOVE_VISIBLE_ACTIVE    (1<<8)  /* Move Screen */
  191.  
  192. /* Cycle Windows */
  193. #define HKO_BACK_CYCLE             (1<<0)
  194. #define HKO_EXCLUDE_WB_DRAWERS     (1<<1)
  195. #define HKO_BY_WINDOW_TASK_NAME    (1<<2)
  196. #define HKO_TASK_NAME_PATTERN      (1<<3)
  197. #define HKO_ACTIVATE_ONLY          (1<<4)
  198.  
  199. /* Insert Date */
  200. #define HKO_DATE_FORMAT   (1<<0)
  201.  
  202. /* Insert Text */
  203. #define HKO_INSERT_STRING (1<<0)
  204. #define HKO_INSERT_DELAY  (1<<1)
  205.  
  206. /* Menu */
  207. #define HKO_MENU_NUMBER    (1<<0)
  208. #define HKO_ITEM_NUMBER    (1<<1)
  209. #define HKO_SUBITEM        (1<<2)
  210. #define HKO_SUBITEM_NUMBER (1<<3)
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. /*
  218.  * Info for anyone to examine
  219.  */
  220. extern YakHotKeyType yhktypes[NUM_HOTKEY_TYPES];
  221. extern UWORD num_hkeys;
  222.  
  223. #define YHK_Takes_Opt(yhk)  (yhktypes[(yhk)->yhk_Type].yhkt_OptsNum)
  224.  
  225. #define keylist(type)       ((struct List *)&yhktypes[type].yhkt_list)
  226. #define numkeys(type)       yhktypes[type].yhkt_count
  227.  
  228.  
  229.  
  230.  
  231.  
  232. /*
  233.  * And functions for anyone to call
  234.  */
  235. void PerformAction(YakHotKey *yhk);
  236. void DeleteYakHotKey(YakHotKey *yhk);
  237. int ModifyYHKKeyDef(YakHotKey *yhk, char *keystr);
  238. int ModifyYHKName(YakHotKey *yhk, char *namestr);
  239. YakHotKey *NewYakHotKey(UWORD type);
  240. void InitYakHotKeyList(void);
  241. void DeleteYakHotKeyList(void);
  242. APTR ControlYakHotKey(YakHotKey *yhk);
  243. int OkayToExit(void);
  244. char *DupStr(char *str);
  245.  
  246. void DefaultOptions(YakHotKey *yhk);
  247.  
  248. #endif
  249.